import request from '@/utils/axios'

export interface TenantType {
  id: number
  name: string
  contactName: string
  contactMobile: string
  status: number
  remark: string
  domain: string
  packageId: number
  username: string
  password: string
  expireTime: Date
  create_time?: Date
}

export interface TenantPageReqType extends PageParam {
  name?: string
  contactName?: string
  contactMobile?: string
  status?: number
  create_time?: Date[]
}

export interface TenantExportReqType {
  name?: string
  contactName?: string
  contactMobile?: string
  status?: number
  create_time?: Date[]
}

/**
 * 租户接口
 */
export const TenantApi = {
  // 新增
  create: (data: TenantType) => {
    return request.post({ url: '/system/tenant/create', data, is_mock: true })
  },
  // 修改
  update: (data: TenantType) => {
    return request.put({ url: '/system/tenant/update', data, is_mock: true })
  },
  // 删除
  delete: (id: number) => {
    return request.delete({ url: '/system/tenant/delete?id=' + id, is_mock: true })
  },
  // 查询详情
  detail: (id: number) => {
    return request.get({ url: '/system/tenant/detail?id=' + id, is_mock: true })
  },
  // 查询分页列表
  page: (params: TenantPageReqType) => {
    return request.get({ url: '/system/tenant/page', params, is_mock: true })
  },
  // 查询列表
  simple: () => {
    return request.get({ url: '/system/tenant/simple-list', is_mock: true })
  },
  // 导出
  export: (params: TenantExportReqType) => {
    return request.get({ url: '/system/tenant/export', params, is_mock: true })
  }
}
